package main

import (
	"fmt"
	"sync"
)

func main() {
	var count int
	var mu sync.Mutex
	var sg sync.WaitGroup
	for i := 0; i < 10000; i++ {
		go func() {
			sg.Add(1)
			defer sg.Done()
			mu.Lock()
			count++
			mu.Unlock()
		}()
	}
	sg.Wait()
	fmt.Println(count)
}
